package com.shxy.controller.ui;

import com.shxy.entity.Employee;
import com.shxy.entity.common.enums.DistrictEnum;
import com.shxy.entity.common.enums.EthicEnum;
import com.shxy.entity.common.enums.GenderEnum;
import com.shxy.entity.common.enums.PoliticalEnum;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.PastOrPresent;
import javax.validation.constraints.Pattern;
import java.util.Date;

@Data
public class EmployeeBean {
    // 添加时校验
    public interface Add {}
    // 修改时校验
    public interface Update{}

    @NotEmpty(message = "编号不能为空", groups = Update.class)
    protected String id;                  // 编号
    @NotNull(message = "性别不能为空", groups = { Add.class, Update.class})
    protected String name;                // 性别
    @NotNull(message = "性别不能为空", groups = { Add.class, Update.class})
    @Pattern(regexp = "^(\\d{18,18}|\\d{15,15}|(\\d{17,17}[x|X]))$", message = "请输入合法的身份证号")
    protected String idCard;              // 身份证号码
    @NotNull(message = "民族不能为空", groups = { Add.class, Update.class})
    protected EthicEnum ethic;            // 民族
    @NotNull(message = "政治面貌不能为空", groups = { Add.class, Update.class})
    protected PoliticalEnum political;    // 政治面貌
    @NotNull(message = "电话号码不能为空", groups = { Add.class, Update.class})
    protected String phone;               // 电话号码
    @NotNull(message = "家庭住址不能为空", groups = { Add.class, Update.class})
    protected String address;             // 家庭住址
    @NotNull(message = "籍贯不能为空", groups = { Add.class, Update.class})
    protected DistrictEnum nativePlace;   // 籍贯
    @NotNull(message = "性别不能为空", groups = { Add.class, Update.class})
    protected GenderEnum gender;          // 性别
    @NotNull(message = "参加工作时间不能为空", groups = { Add.class, Update.class})
    @PastOrPresent(message = "参加工作时间填写错误")
    protected Date startDate;             // 参加工作时间
}
